<%@ page language="java" import="java.util.*,com.fescoservice.model.*" pageEncoding="UTF-8"%>

<%
	String langfilename = "/resources/message";


	String serchOptionSel =  request.getAttribute("SerchOptionSel")==null?"":(String)request.getAttribute("SerchOptionSel");
	String serchOptionValue =  request.getAttribute("SerchOptionValueSel")==null?"":(String)request.getAttribute("SerchOptionValueSel");
	Customer cust =(Customer) request.getAttribute("Customer");


	String userId =  request.getAttribute("userId")==null?"":(String)request.getAttribute("userId");
	String userRole =  request.getAttribute("userRole")==null?"":(String)request.getAttribute("userRole");
	String userDept =  request.getAttribute("userDept")==null?"":(String)request.getAttribute("userDept");
	

	
	Long counts =request.getAttribute("counts")==null?0:(Long) request.getAttribute("counts");
	List applicationslist =request.getAttribute("applicationslist")==null?new ArrayList():(List<Application>) request.getAttribute("applicationslist");
	

	
%>
<%@include file="../common/LocaleManager.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Fesco Service</title>
		<link rel="stylesheet" href="<%=path%>/js/jquery/themes/redmond/jquery.ui.all.css">
		<script src="<%=path%>/js/jquery/jquery-1.5.1.js"></script>
		<script src="<%=path%>/js/FormCheck.js"></script>
		<script src="<%=path%>/js/common.js"></script>
	    <script src="<%=path%>/js/resources_zh_CN.js"></script>
		
		
		<script src="<%=path%>/js/jquery/external/jquery.bgiframe-2.1.2.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.core.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.widget.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.mouse.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.button.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.draggable.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.position.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.resizable.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.dialog.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.effects.core.js"></script>
		<link rel="stylesheet" href="<%=path%>/css/admin.css">
	
		<style type="text/css">
		
		</style>
		<script type="text/javascript">
			$(function() {
				$("#btnAdd").button().click(function() {									
					document.forms.mainForm.action = '<%=path%>/action/Customer.htm?cmd=addApplicationInit';
					document.forms.mainForm.submit();		
				});
				$("#btnBack").button().click(function() {
					document.forms.mainForm.action = '<%=path%>/action/Customer.htm?cmd=list';
					document.forms.mainForm.submit();		
				});
			});
			
			function modify(applyId){
				document.forms.mainForm.action = '<%=path%>/action/Customer.htm?cmd=modifyApplicationInit';		
				document.forms.mainForm.applyId.value = applyId;
				document.forms.mainForm.submit();
			}
			function viewContent(applyId){
				document.forms.mainForm.action = '<%=path%>/action/Customer.htm?cmd=viewApplication';	
				document.forms.mainForm.applyId.value = applyId;
				document.forms.mainForm.submit();
			}

		</script>
	</head>
	<body>
		
		<div class="wrapContent">	
			<div class="ui-widget">	
				<div class="ui-widget-header">
					<%=resource.getString("FS_T_VIEW")%><%=resource.getString("FS_T_CUSTOMER")%>
				</div>
				<form name="mainForm" method="post">
				<div class="">
					
					<table style="margin-top: 0">
						<tr><td nowrap  width="15%"> 
							<label for="custNameEn">
								<%=resource.getString("FS_T_CUST_NAME_EN")%>
							</label>
							</td>
							<td nowrap  width="35%"> 
							<%=cust.getCustFirstnameEn()+" "+cust.getCustLastnameEn() %>
						    </td>
							<td nowrap  width="15%"> 
							<label for="passId">
								<%=resource.getString("FS_T_CUST_PASS_ID")%>
							</label>
							</td>
							<td nowrap  width="35%"> 
							<%=cust.getPassId() %>
							<input type="hidden" name="SerchOptionSel" class=" ui-corner-all" value="<%=serchOptionSel %>" />	
							<input type="hidden" name="SerchOptionValueSel" class=" ui-corner-all" value="<%=serchOptionValue %>" />
							<input type="hidden" name="custId" class=" ui-corner-all" value="<%=cust.getCustId() %>" />	
							<input type="hidden" name="applyId" class=" ui-corner-all" value="" />	
							
							<input type="hidden" name="companyId" class=" ui-corner-all" value="<%=cust.getCompanyId() %>" />	
							<input type="hidden" name="companyName" class=" ui-corner-all" value="<%=cust.getCompanyName() %>" />	
							<input type="hidden" name="companyAddr" class=" ui-corner-all" value="<%=cust.getCompanyAddr() %>" />	
							</td>
						</tr>
						
						<tr><td nowrap  width="15%"> 
							<label for="passValidDate">
								<%=resource.getString("FS_T_CUST_PASS_VALID_DATE")%>
							</label>
							</td>
							<td nowrap  width="35%"> 
							<%=cust.getPassValidDate() %>
							</td>						
							<td nowrap  width="15%">
							<label for="custNameCn">
								<%=resource.getString("FS_T_CUST_NAME_CN")%>
							</label>
							</td>
							<td nowrap  width="35%"> 
							<%=cust.getCustNameCn() %>
							</td>
						</tr>
						<tr><td nowrap  width="15%"> 
							<label for="birthDate">
								<%=resource.getString("FS_T_CUST_BIRTH_DATE")%>
							</label>
							</td>
							<td nowrap  width="35%"> 
							<%=cust.getBirthDate() %>
							</td>
							<td nowrap  width="15%"> 
							<label for="phone">
								<%=resource.getString("FS_T_CUST_NAME_PHONE")%>
							</label>
							</td>
							<td nowrap  width="35%"> 							
							<%=cust.getPhone() %>
							</td>
						</tr>
						<tr><td nowrap  width="15%"> 
							<label for="companyName">
								<%=resource.getString("FS_T_CUST_COMPANY_NAME")%>
							</label>
							</td>
							<td nowrap  width="35%"> 
							<%=cust.getCompanyName()%>
							
							</td>
							<td nowrap  width="15%"> 
							<label for="companyAddr">
								<%=resource.getString("FS_T_COMP_COMPANY_ADDR")%>
							</label>
							</td>
							<td nowrap  width="35%"> 
							<%=cust.getCompanyAddr()%>
							</td>
						</tr>
						<tr><td nowrap  width="15%"> 
							<label for="custAddr">
								<%=resource.getString("FS_T_COMP_CUST_ADDR")%>
							</label>
							<td nowrap   colspan="3"> 
								<%=cust.getCustAddr()%>
							</td></tr>
						</table>
						
						
						
			
				</div>
					<table class="ui-widget ui-widget-content">
					<thead>
						<tr class="ui-widget-header ">
							<th>
								<%=resource.getString("FS_T_APPLICATION_NAME")%>
								<div id="create-menu1"></div>
							</th>
							<th>
								<%=resource.getString("FS_T_APPLICATION_STATUS")%>
								<div id="create-menu2"></div>
							</th>
							<th>
								<%=resource.getString("FS_T_APPLICATION_FINISH_TIME")%>
								<div id="create-menu3"></div>
							</th>		
							<th>
								<%=resource.getString("FS_T_APPLICATION_FEE_STATUS")%>
								<div id="create-menu3"></div>
							</th>	
							<th>
								<%=resource.getString("FS_T_APPLICATION_CREATOR")%>
								<div id="create-menu3"></div>
							</th>		
							<th nowrap >
								<%=resource.getString("FS_T_OPERATION_COL")%>
								<div id="create-menu3"></div>
							</th>							
						</tr>
					</thead>
					<tbody>
									<% if(applicationslist.size()>0) { 
										Application apply = null;
							for(int i=0;i<applicationslist.size();i++){
								apply = (Application)applicationslist.get(i);
					%>
					
						<tr class="operTR<%=i%2 %>" >
							<td nowrap   >					
								
							<%if("A".equals(apply.getApplyKey())){%>
								<%=resource.getString("FS_T_APPLICATION_KEY_WORK_AUTH")%>
							<%}else if("B".equals(apply.getApplyKey())){%>
								<%=resource.getString("FS_T_APPLICATION_KEY_VISA_INVITATION")%>
							<%}else if("C".equals(apply.getApplyKey())){%>
								<%=resource.getString("FS_T_APPLICATION_KEY_WORK")%>
							<%}else if("D".equals(apply.getApplyKey())){%>
								<%=resource.getString("FS_T_APPLICATION_KEY_LIVE_AUTH")%>
							<%}else if("E".equals(apply.getApplyKey())){%>
								<%=resource.getString("FS_T_APPLICATION_KEY_WORK_DELAY")%>
							<%}else if("F".equals(apply.getApplyKey())){%>
								<%=resource.getString("FS_T_APPLICATION_KEY_DRIVE")%>
							<%}else if("G".equals(apply.getApplyKey())){%>
								<%=resource.getString("FS_T_APPLICATION_KEY_ABORD")%>
							<%}	%>		
							
							</td>
							<td nowrap   >
							<%if("1".equals(apply.getStatus())){%>
								<%=resource.getString("FS_T_APPLICATION_OPER_STATUS_NOT")%>
							<%}else if("2".equals(apply.getStatus())){%>
								<%=resource.getString("FS_T_APPLICATION_OPER_STATUS_ING")%>
							<%}else if("3".equals(apply.getStatus())){%>
								<%=resource.getString("FS_T_APPLICATION_OPER_STATUS_FINISH")%>
							<%}%>
							</td>
							<td nowrap   >
								<%=apply.getPreDate() %>
							</td>
							<td nowrap   >
							<%if("1".equals(apply.getFeeStatus())){%>
								<%=resource.getString("FS_T_APPLICATION_FEE_STATUS_NOT")%>
							<%}else if("2".equals(apply.getFeeStatus())){%>
								<%=resource.getString("FS_T_APPLICATION_FEE_STATUS_FINISH")%>
							<%}%>
							</td>
							<td nowrap   >
								<%=apply.getCreatorName() %>
							</td>

							<td nowrap    class="operation">	
								<div nowrap><a href="javascript:modify('<%=apply.getApplyId()%>');" ><%=resource.getString("FS_T_MODIFY")%></a></div>							
								<div nowrap><a href="javascript:viewContent('<%=apply.getApplyId()%>');" ><%=resource.getString("FS_T_VIEWCONTENT")%></a></div>
							</td>						
						</tr>
					<%	}
					}else{ %>

						<tr>
							<td nowrap    colspan="6">
								<%=resource.getString("FS_M_NORESULT")%>
							</td>
						</tr>
					<%} %>
					</tbody>
				</table>
				</form>
				<div nowrap class="buttonGroupRight">
			   		<div nowrap id="btnAdd" ><%=resource.getString("FS_T_ADD")%></div>
					<div nowrap id="btnBack" ><%=resource.getString("FS_T_LIST")%></div>
				</div>	
			
			</div>
		</div>
		<script type="text/javascript"	>	
		//import scripts below to pages which display in right frame, for ajust the scroll height
		parent.scroll(0,0);
		parent.setFrameHeight(document.body.scrollHeight+200);
		</script>
	</body>
</html>